
/**
 * 
 * @author Lukas Koell
 * @author David Medenjak
 * @author Johannes Riedmann
 */
public abstract class Compartment {

    /** animal in the compartment */
    protected Animal animal;

    /**
     * @return animal in the compartment
     */
    public Animal getAnimal() {
        return animal;
    }

    /**
     * insert an animal into the compartment
     * @param animal we'd like to insert into the compartment
     * @return true if insert succeeded, else false
     */
    public boolean insertAnimal(Animal animal) {
        if (this.animal == null) {
            this.animal = animal;
            animal.setCompartment(this);
            return true;
        } else {
            return false;
        }
    }

    /**
     * release the animal from the compartment
     * @return released animal
     */
    public Animal unload() {
        Animal ret = this.animal;
        animal = null;
        return ret;
    }

    /**
     * Inserts a python by calling insert animal.
     * @param python Animal to add.
     * @return true if it succeeded, false if not.
     */
    public abstract boolean insertPython(Python python);

    /**
     * Inserts a python by calling insert animal.
     * @param python Animal to add.
     * @return true if it succeeded, false if not.
     */
    public abstract boolean insertDelfin(Delfin delfin);

    /**
     * Inserts a mamba by calling insert animal.
     * @param mamba Animal to add.
     * @return true if it succeeded, false if not.
     */
    public abstract boolean insertMamba(Mamba mamba);

    /**
     * Inserts a Riesenschildkröte by calling insert animal.
     * @param schildi Animal to add.
     * @return true if it succeeded, false if not.
     */
    public abstract boolean insertRiesenschildkroete(Riesenschildkroete schildi);

    /**
     * Inserts a swordfish by calling insert animal.
     * @param schwertfisch Animal to add.
     * @return true if it succeeded, false if not.
     */
    public abstract boolean insertSchwertfisch(Schwertfisch schwertfisch);

    /**
     * Inserts a seehund by calling insert animal.
     * @param seehund Animal to add.
     * @return true if it succeeded, false if not.
     */
    public abstract boolean insertSeehund(Seehund seehund);

    /**
     * Inserts a zwergschildkröte by calling insert animal.
     * @param schildi Animal to add.
     * @return true if it succeeded, false if not.
     */
    public abstract boolean insertZwergschildkroete(Zwergschildkroete schildi);

    /**
     * Returns false, as it's not possible.
     * @param giraffe Animal to add.
     * @return False, as Giraffe cant travel in boxes ;)
     */
    public boolean insertGiraffe(Giraffe giraffe) {
        return false;
    }

    /**
     * Returns false, as it's not possible.
     * @param elephant Animal to add.
     * @return False, as elephant cant travel in boxes ;)
     */
    public boolean insertElephant(Elefant elephant) {
        return false;
    }
}
